package com.petdrug.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.petdrug.entity.UserEntity;
import com.petdrug.service.IUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class UserController {
    @Reference
    IUserService userService;

    @RequestMapping("jumpregister")
    public String jumpregister(){
        return "register";
    }

    @RequestMapping("register")
    public String register(UserEntity userEntity){
        boolean flg = userService.register(userEntity);

        return "login";
    }

    @RequestMapping("jumplogin")
    public String jumplogin(){
        return "login";
    }

    @RequestMapping("login")
    public String login(String uname,String upass){
        UserEntity user = userService.login(uname,upass);
        if (null == user){
            return "register";
        }
        return "product";
    }


}
